﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using ScrumPilot.Domain.Helpers;
using ScrumPilot.TFSHelpers;

namespace ScrumPilot.Domain.Models
{
    /// <summary>
    /// Task model for edit
    /// </summary>
    /// 
    public class Task : IIWorkItem
    {
        [Key]
        public int ID { get; set; }

        [Required]
        [Display(Name = "Task title", Description = "Task title", Prompt = "Task title")]
        [DataType(DataType.MultilineText)]
        public string Title { get; set; }

        [DataType(DataType.MultilineText)]
        public string Description { get; set; }

        public string Area { get; set; }

        [Display(Name = "Area/Module")]
        public IDictionary<String,String> Areas { get; set; }

        public WorkItemState State { get; set; }
        public bool IsReopen { get; set; }

        [Required]
        public string Sprint { get; set; }

        [Display(Name = "Project/Sprint")]
        public IDictionary<String, String> Sprints { get; set; }

        public Nullable<Int32> AssignedToID { get; set; }

        [Display(Name = "Assigned to")]
        public string AssignedTo { get; set; }

        public void CompleteInit(Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem wie, TFSServices tfs, bool inSameIteration)
        {
            throw new NotImplementedException();
        }

        public int Score { get; set; }
        public String Creator { get; set; }
        public DateTime CreateDate { get; set; }
        public List<TFSAttachment> Attachments { get; set; }
    }

    public class TaskForList : WorkItem
    {
        public string Area { get; set; }
        public Boolean IsReopen { get; set; }
        public Boolean IsBug { get; set; }
        public string Sprint { get; set; }
        public Boolean AssignedToMe { get; set; }
        public Boolean ActionToDo { get; set; }
        public Boolean ActionInProgress { get; set; }
        public Boolean ActionToTest { get; set; }
        public Boolean ActionDone { get; set; }
    }

    public class TaskForScore
    {
        [Key]
        public int ID { get; set; }
        [Display(Name = "Expert Level")]
        [Range(1, 5)]
        [EnumDataType(typeof(ExpertLevelScoring))]
        public Byte Level { get; set; }
        [Display(Name = "Task priority")]
        [Range(1, 5)]
        [EnumDataType(typeof(TaskPriorityScoring))]
        public Byte Priority { get; set; }
        [Display(Name = "Task duration")]
        [Range(1, 5)]
        [EnumDataType(typeof(TaskDurationScroring))]
        public Byte Duration { get; set; }
        public DateTime Date { get; set; }
    }

    public class TaskForMove
    {
        [Key]
        public int ID { get; set; }

        [Display(Name = "From")]
        [ReadOnly(true)]
        [DataType(DataType.Text)]
        public String CurrentProject { get; set; }

        [Required]
        public Int32 NewProjectId { get; set; }
        [Display(Name = "To")]
        public IDictionary<int, String> NewProjects { get; set; }

        [Display(Name = "Copy")]
        public Boolean MoveOrCopy { get; set; }
    }
}
